/*
 Navicat Premium Data Transfer

 Source Server         : lesson
 Source Server Type    : MySQL
 Source Server Version : 80020
 Source Host           : localhost:3306
 Source Schema         : lianxi01

 Target Server Type    : MySQL
 Target Server Version : 80020
 File Encoding         : 65001

 Date: 19/07/2020 16:18:40
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for course
-- ----------------------------
DROP TABLE IF EXISTS `course`;
CREATE TABLE `course` (
  `id` int NOT NULL AUTO_INCREMENT,
  `NAME` varchar(20) DEFAULT NULL,
  `teacher_id` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `teacher_id` (`teacher_id`),
  CONSTRAINT `course_ibfk_1` FOREIGN KEY (`teacher_id`) REFERENCES `teacher` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of course
-- ----------------------------
BEGIN;
INSERT INTO `course` VALUES (1, '语文', 1);
INSERT INTO `course` VALUES (2, '数学', 1);
INSERT INTO `course` VALUES (3, '生物', 2);
INSERT INTO `course` VALUES (4, '化学', 2);
INSERT INTO `course` VALUES (5, '物理', 2);
INSERT INTO `course` VALUES (6, '英语', 3);
COMMIT;

-- ----------------------------
-- Table structure for dept
-- ----------------------------
DROP TABLE IF EXISTS `dept`;
CREATE TABLE `dept` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of dept
-- ----------------------------
BEGIN;
INSERT INTO `dept` VALUES (1, '开发部');
INSERT INTO `dept` VALUES (2, '市场部');
INSERT INTO `dept` VALUES (3, '财务部');
COMMIT;

-- ----------------------------
-- Table structure for employee
-- ----------------------------
DROP TABLE IF EXISTS `employee`;
CREATE TABLE `employee` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(10) DEFAULT NULL,
  `gender` char(1) DEFAULT NULL,
  `salary` double DEFAULT NULL,
  `join_date` date DEFAULT NULL,
  `dept_id` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `dept_id` (`dept_id`),
  CONSTRAINT `employee_ibfk_1` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of employee
-- ----------------------------
BEGIN;
INSERT INTO `employee` VALUES (1, '孙悟空', '男', 7200, '2013-02-24', 1);
INSERT INTO `employee` VALUES (2, '猪八戒', '男', 3600, '2010-12-02', 2);
INSERT INTO `employee` VALUES (3, '唐僧', '男', 9000, '2008-08-08', 2);
INSERT INTO `employee` VALUES (4, '白骨精', '女', 5000, '2015-10-07', 3);
INSERT INTO `employee` VALUES (5, '蜘蛛精', '女', 4500, '2011-03-14', 1);
COMMIT;

-- ----------------------------
-- Table structure for lagou_category
-- ----------------------------
DROP TABLE IF EXISTS `lagou_category`;
CREATE TABLE `lagou_category` (
  `id` int NOT NULL AUTO_INCREMENT,
  `category_name` varchar(20) DEFAULT NULL,
  `category_desc` varchar(50) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of lagou_category
-- ----------------------------
BEGIN;
INSERT INTO `lagou_category` VALUES (1, '后端开发', '后端课程包括 Java PHP Python', '2020-03-27 00:44:04', '2020-03-27 00:44:04');
INSERT INTO `lagou_category` VALUES (2, '前端开发', '前端课程包括 JQuery VUE angularJS', '2020-02-27 10:00:04', '2020-02-27 18:44:04');
COMMIT;

-- ----------------------------
-- Table structure for lagou_course
-- ----------------------------
DROP TABLE IF EXISTS `lagou_course`;
CREATE TABLE `lagou_course` (
  `id` int NOT NULL AUTO_INCREMENT,
  `teacher_id` int DEFAULT NULL,
  `category_id` int DEFAULT NULL,
  `title` varchar(20) DEFAULT NULL,
  `total_class` int DEFAULT NULL,
  `views` int DEFAULT NULL,
  `course_status` char(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `teach_fk` (`teacher_id`),
  KEY `course_fk` (`category_id`),
  CONSTRAINT `course_fk` FOREIGN KEY (`category_id`) REFERENCES `lagou_course` (`id`),
  CONSTRAINT `teach_fk` FOREIGN KEY (`teacher_id`) REFERENCES `lagou_teacher` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of lagou_course
-- ----------------------------
BEGIN;
INSERT INTO `lagou_course` VALUES (1, 1, 1, 'Java', 300, 250000, '1');
INSERT INTO `lagou_course` VALUES (2, 2, 2, 'VUE', 400, 200000, '1');
COMMIT;

-- ----------------------------
-- Table structure for lagou_teacher
-- ----------------------------
DROP TABLE IF EXISTS `lagou_teacher`;
CREATE TABLE `lagou_teacher` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(20) DEFAULT NULL,
  `description` varchar(50) DEFAULT NULL,
  `level` char(4) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name_index` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of lagou_teacher
-- ----------------------------
BEGIN;
INSERT INTO `lagou_teacher` VALUES (1, '刘德华', '毕业于清华大学，主攻前端技术,授课风格生动活泼,深受学员喜爱', '高级讲师');
INSERT INTO `lagou_teacher` VALUES (2, '郭富城', '毕业于北京大学，多年的IT经验，研发多项Java课题,授课经验丰富', '首席讲师');
COMMIT;

-- ----------------------------
-- Table structure for product
-- ----------------------------
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
  `pid` int NOT NULL,
  `pname` varchar(20) DEFAULT NULL,
  `price` double DEFAULT NULL,
  `category_name` varchar(32) DEFAULT NULL,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of product
-- ----------------------------
BEGIN;
INSERT INTO `product` VALUES (1, '联想电脑', 5000, '电脑办公');
INSERT INTO `product` VALUES (2, '海尔电脑', 3000, '电脑办公');
INSERT INTO `product` VALUES (3, '雷神电脑', 5000, '电脑办公');
INSERT INTO `product` VALUES (4, 'JACK JONES', 800, '服装');
INSERT INTO `product` VALUES (5, '真维斯', 200, '服装');
INSERT INTO `product` VALUES (6, '花花公子', 440, '服装');
INSERT INTO `product` VALUES (7, '劲霸', 2000, '服装');
INSERT INTO `product` VALUES (8, '香奈儿', 800, '女士用品');
INSERT INTO `product` VALUES (9, '相宜本草', 200, '女士用品');
INSERT INTO `product` VALUES (10, '面霸', 5, '女士用品');
INSERT INTO `product` VALUES (11, '雪碧', 56, '饮料饮品');
INSERT INTO `product` VALUES (12, '香飘飘奶茶', 1, '饮料饮品');
INSERT INTO `product` VALUES (13, 'iPhone9', 8000, NULL);
COMMIT;

-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
  `id` int NOT NULL AUTO_INCREMENT,
  `NAME` varchar(20) DEFAULT NULL,
  `city` varchar(10) DEFAULT NULL,
  `age` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of student
-- ----------------------------
BEGIN;
INSERT INTO `student` VALUES (1, '小王', '北京', 20);
INSERT INTO `student` VALUES (2, '小李', '上海', 18);
INSERT INTO `student` VALUES (3, '小周', '北京', 22);
INSERT INTO `student` VALUES (4, '小刘', '北京', 21);
INSERT INTO `student` VALUES (5, '小张', '上海', 22);
INSERT INTO `student` VALUES (6, '小赵', '北京', 17);
INSERT INTO `student` VALUES (7, '小蒋', '上海', 23);
INSERT INTO `student` VALUES (8, '小韩', '北京', 25);
INSERT INTO `student` VALUES (9, '小魏', '上海', 25);
INSERT INTO `student` VALUES (10, '小明', '北京', 20);
COMMIT;

-- ----------------------------
-- Table structure for teacher
-- ----------------------------
DROP TABLE IF EXISTS `teacher`;
CREATE TABLE `teacher` (
  `id` int NOT NULL AUTO_INCREMENT,
  `NAME` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of teacher
-- ----------------------------
BEGIN;
INSERT INTO `teacher` VALUES (1, '关羽');
INSERT INTO `teacher` VALUES (2, '张飞');
INSERT INTO `teacher` VALUES (3, '赵云');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
